<?php
class AccounttypeController extends CommonController
{
	public function index()
	{
		$accounttypeModelCls = new AccounttypeModel();
		$this->view->assign('AccountType', $accounttypeModelCls->getAll());
		$this->view->assign('title', '账户类型管理');
		$this->view->display();
	}
	
	/**
	 * 添加账户类型
	 */
	public function add()
	{
		$do = Functions::gpc('do', 'p');
		$accounttypeModelCls = new AccounttypeModel();
		if($do == 'save')
		{
			$data['AccountTypeName'] = Functions::sqlgpc('AccountTypeName', 'p');
			$data['Status'] = Functions::sqlgpc('Status', 'p');
			$data['CreateDate'] = time();
			$data['Remark'] = Functions::sqlgpc('Remark', 'p');
			$accounttypeModelCls->add($data);
		}
		$this->view->assign('AccountType', $accounttypeModelCls->getAll());
		$this->view->display();
	}
	
	public function __destruct()
	{
		//echo 'index controller destruct!<br />';
	}
}